import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/common/xindong_define.dart';
import 'package:xindong/res/assets_res.dart';
import 'package:xindong/utils/xindong_image_util.dart';

// 分割线
Widget commonDivider({Color? color, Color? backgroundColor, double indent = kPaddingValue, double endIndent = kPaddingValue}) {
  return Container(
    color: backgroundColor,
    child: Divider(
      height: 1.0,
      indent: indent,
      endIndent: endIndent,
      color: color ?? DZColors.dividerColor,
    ),
  );
}

// 视频播放器封面层
Widget videoPlayerCoverLayer(String? coverUrl) {
  if (coverUrl == null) return const SizedBox();
  return Container(
    color: Colors.black.withOpacity(0.38),
    alignment: Alignment.center,
    child: ImageUtil.networkImageUrl(coverUrl),
  );
}

// 视频播放器封暂停层
Widget videoPlayerPauseLayer = Container(
  color: Colors.black.withOpacity(0.38),
  alignment: Alignment.center,
  child: ImageUtil.asset(AssetsRes.ICON_VIDEO_PLAY, width: 40, height: 40),
);

// 视频播放器关闭按钮
Widget videoPlayerCloseButton({Function()? onPressed}) {
  return Container(
    width: 30,
    height: 30,
    alignment: Alignment.center,
    decoration: BoxDecoration(color: Colors.black.withOpacity(0.38), borderRadius: BorderRadius.circular(30)),
    child: IconButton(
      onPressed: onPressed,
      padding: EdgeInsets.zero,
      icon: const Icon(Icons.close, color: Colors.white),
    ),
  );
}
